package com.kan.awaits.mongo.meta;

import com.kan.awaits.mongo.annotations.Collection;

/**
 * 管理集合,数据库中一个集合对应一个CollectionMeta
 * 
 * @author Elva
 * @date 2011-4-14
 * @version 1.0
 */
public class CollectionMeta
{
	String name;// 集合名称

	boolean automaticallyGenerate;// 是否自动生成

	Boolean capped;

	Integer size;

	Integer maxDocuments;

	volatile Boolean exist;// 集合是否已经被创建

	public CollectionMeta(Collection collection)
	{
		this.name = collection.name();
		this.automaticallyGenerate = collection.automaticallyGenerate();
		this.size = collection.size();
		if (size <= 0)
		{
			size = null;
		}
		this.capped = collection.capped();

		this.maxDocuments = collection.maxDocuments();
		if (maxDocuments <= 0)
		{
			maxDocuments = null;
		}
	}

	public CollectionMeta()
	{

	}
}
